﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Video.aspx.cs" Inherits="Pages_Dashboard_Account_Video" %>

<%@ Register Src="~/Controls/Social/SnSelector.ascx" TagPrefix="uc" TagName="SnSelector" %>
<%@ Register Src="~/Controls/Reports/PostStats.ascx" TagPrefix="uc" TagName="PostStats" %>
<%@ Register Src="~/Controls/General/SideMenus/AccountSideMenu.ascx" TagPrefix="uc"
    TagName="AccountSideMenu" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">

    <script type="text/javascript">
		function Redirect() { location.href = '<%=AppParams.URLs.AccountPageUrl(AccountID) %>'; }
		function Upload() {
			if (!uploader.checkForFile())
				return;

			var title = $('#<%=tbTitle.ClientID %>').val();
			var description = $('#<%=tbDescription.ClientID %>').val();
			var category = $('#<%=ddlCategory.ClientID %>').val();
			var networks = GetSocialNetworkSelector();
			var data = "{accountID:<%=AccountID %>,title:'" + title + "',keywords:'happy',category:'" + category + "',description:'" + description + "',isFacebook:" + networks.IsFacebook + ",isTwitter:" + networks.IsTwitter + "}";

			$.ajax(
			  {
			      data: data,
			      type: "Post",
			      url: "/Service/WebsiteService.asmx/CreateVideo",
			      success: CreateVideoCallback,
			      error: function () { alert('Please try again'); },
			      dataType: "json",
			      contentType: "application/json; charset=utf-8"
			  });

		}
		function CreateVideoCallback(response) {
        	uploader.submitForm(response.d.Url, response.d.Token);
        }

    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="UploadForm">
        <div>
            <h2>
                Title</h2>
            <br />
            <div class="PostBorder TextBoxBorder Title">
                <ui:TextBox runat="server" ID="tbTitle" CssClass="TextBox" TextMode="SingleLine"
                    Rows="1" Columns="18" ToolTip="Text" BorderWidth="0" AutoResize="false"></ui:TextBox>
            </div>
        </div>
        <br />
        <div>
            <h2>
                Description</h2>
            <br />
            <div class="PostBorder TextBoxBorder Description">
                <ui:TextBox runat="server" ID="tbDescription" CssClass="TextBox" TextMode="MultiLine"
                    Rows="2" Columns="95" ToolTip="Text" BorderWidth="0" AutoResize="true"></ui:TextBox>
            </div>
        </div>
        <div style="display: none">
            <span>KeyWords</span>
            <asp:TextBox ID="tbKeywords" runat="server" />
        </div>
        <br />
        <div>
            <h2>
                Category</h2>
            <br />
            <asp:DropDownList runat="server" ID="ddlCategory">
            </asp:DropDownList>
        </div>
        <br />
        <br />
        <br />
        <div class="UploadVideoContainer">
            <h2>
                Select a video file
            </h2>
            <hr />
            <p>
                Videos can be...
                <ul>
                    <li>High Definition </li>
                    <li>Up to 2 GB in size.</li><li>Up to 15 minutes in length</li><li>A wide variety of
                        formats</li></ul>
            </p>
            <br />
            <div class="UploadVideo">
                <iframe src="/pages/social/videoUpload.aspx" marginheight="0" marginwidth="0" frameborder="0"
                    height="50" name="uploader"></iframe>
            </div>
        </div>
        <br />
        <uc:SnSelector runat="server" ID="snSelector" />
        <br />
        <label class="PostButtonContainer rFloat">
            <input id="btnPost" onclick="Upload()" class="PostButton" type="button" value="Post" />
        </label>
        <div class="clear">
        </div>
    </div>
    <asp:Label ID="lblMsg" runat="server" />
    <div class="postedItems">
        <h2>
            Recent Posts</h2>
        <hr />
        <ul>
            <asp:Repeater runat="server" ID="repPosts">
                <ItemTemplate>
                    <li class="PostsListItem">
                        <uc:PostStats ID="PostStats1" runat="server" PostID='<%#Eval("ID") %>' />
                    </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="LeftMainColContent">
    <uc:AccountSideMenu ID="ucAccountSideMenu" runat="server" />
</asp:Content>